/*
* @Author: admin
* @Date:   2017-03-02 12:25:01
* @Last Modified by:   haopeidong
* @Last Modified time: 2017-03-28 16:37:21
*/

var right = document.getElementById('#right');


$(function(){
		// 首页的轮播图， 如果只有一张图片的话，去掉这js即可不轮播，而且没有小点
		$("#xmSlide").xmSlide({
			width: 1000,
			height: 300,
			// responsiveWidth:710,
			pagination: {
				effect: "fade"  //可换成"slide"
			},
			effect: {
				fade: {
					speed: 400
				}
			},
			play: {
				effect: "fade", //可换成"slide"
				interval: 2000,
				auto: true,
				pauseOnHover: true,
				restartDelay: 1000
			}
		});



		//热门自媒体的切换--1
		$('#stars').mouseover(function(){
			$('.one_starts').css('display','block').siblings('.media_one').css('display','none');
			$(this).children('a').addClass('active_media');
			$(this).siblings('li').children('a').removeClass('active_media');
		})
		$('#fashion').mouseover(function(){
			$('.one_fashion').css('display','block').siblings('.media_one').css('display','none');
			$(this).children('a').addClass('active_media');
			$(this).siblings('li').children('a').removeClass('active_media');
		})
		$('#travel').mouseover(function(){
			$('.one_travel').css('display','block').siblings('.media_one').css('display','none');
			$(this).children('a').addClass('active_media');
			$(this).siblings('li').children('a').removeClass('active_media');
		})
		$('#animaljoy').mouseover(function(){
			$('.one_animaljoy').css('display','block').siblings('.media_one').css('display','none');
			$(this).children('a').addClass('active_media');
			$(this).siblings('li').children('a').removeClass('active_media');
		})
		$('#movie').mouseover(function(){
			$('.one_movie').css('display','block').siblings('.media_one').css('display','none');
			$(this).children('a').addClass('active_media');
			$(this).siblings('li').children('a').removeClass('active_media');
		})



		//热门自媒体的切换--2
		$('#child').mouseover(function(){
			$('.two_child').css('display','block').siblings('.media_two').css('display','none');
			$(this).children('a').addClass('active_media');
			$(this).siblings('li').children('a').removeClass('active_media');
		})
		$('#internet').mouseover(function(){
			$('.two_internet').css('display','block').siblings('.media_two').css('display','none');
			$(this).children('a').addClass('active_media');
			$(this).siblings('li').children('a').removeClass('active_media');
		})
		$('#feeling').mouseover(function(){
			$('.two_feeling').css('display','block').siblings('.media_two').css('display','none');
			$(this).children('a').addClass('active_media');
			$(this).siblings('li').children('a').removeClass('active_media');
		})
		$('#adMedia').mouseover(function(){
			$('.two_adMedia').css('display','block').siblings('.media_two').css('display','none');
			$(this).children('a').addClass('active_media');
			$(this).siblings('li').children('a').removeClass('active_media');
		})
		$('#car').mouseover(function(){
			$('.two_car').css('display','block').siblings('.media_two').css('display','none');
			$(this).children('a').addClass('active_media');
			$(this).siblings('li').children('a').removeClass('active_media');
		})



		//点赞
		$('body').on("click",'.heart1',function(){
			   var D=$(this).attr("rel");
			   if(D === 'like1') {
				      	$(this).addClass("heartAnimation").attr("rel","unlike"); //applying animation class
				}else{
			        $(this).removeClass("heartAnimation").attr("rel","like1");
			        $(this).css("background-position","left");
				}
				//将点赞的数据发送到后台
				// $.ajax({
				// 		url:'',
				// 		type:'post',
				// 		dataType:'json',
				// 		data:{"key":"value"},
				// 		success:function(data){

				// 		}
							
				// })
		});
		$('body').on("click",'.heart2',function(){
			   var D=$(this).attr("rel");
			   if(D === 'like2') {
				    $(this).addClass("heartAnimation").attr("rel","unlike"); //applying animation class
				}else{
			        $(this).removeClass("heartAnimation").attr("rel","like2");
			        $(this).css("background-position","left");
				}
		});
		$('body').on("click",'.heart3',function(){
			   var D=$(this).attr("rel");
			   if(D === 'like3') {
				    $(this).addClass("heartAnimation").attr("rel","unlike"); //applying animation class
				}else{
			        $(this).removeClass("heartAnimation").attr("rel","like3");
			        $(this).css("background-position","left");
				}
		});
		$('body').on("click",'.heart4',function(){
			   var D=$(this).attr("rel");
			   if(D === 'like4') {
				    $(this).addClass("heartAnimation").attr("rel","unlike"); //applying animation class
				}else{
			        $(this).removeClass("heartAnimation").attr("rel","like4");
			        $(this).css("background-position","left");
				}
		});
		$('body').on("click",'.heart5',function(){
			   var D=$(this).attr("rel");
			   if(D === 'like5') {
				    $(this).addClass("heartAnimation").attr("rel","unlike"); //applying animation class
				}else{
			        $(this).removeClass("heartAnimation").attr("rel","like5");
			        $(this).css("background-position","left");
				}
		});
		$('body').on("click",'.heart6',function(){
			   var D=$(this).attr("rel");
			   if(D === 'like6') {
				    $(this).addClass("heartAnimation").attr("rel","unlike"); //applying animation class
				}else{
			        $(this).removeClass("heartAnimation").attr("rel","like6");
			        $(this).css("background-position","left");
				}
		});
		$('body').on("click",'.heart7',function(){
			   var D=$(this).attr("rel");
			   if(D === 'like7') {
				    $(this).addClass("heartAnimation").attr("rel","unlike"); //applying animation class
				}else{
			        $(this).removeClass("heartAnimation").attr("rel","like7");
			        $(this).css("background-position","left");
				}
		});
		$('body').on("click",'.heart8',function(){
			   var D=$(this).attr("rel");
			   if(D === 'like8') {
				    $(this).addClass("heartAnimation").attr("rel","unlike"); //applying animation class
				}else{
			        $(this).removeClass("heartAnimation").attr("rel","like8");
			        $(this).css("background-position","left");
				}
		});
		$('body').on("click",'.heart9',function(){
			   var D=$(this).attr("rel");
			   if(D === 'like9') {
				    $(this).addClass("heartAnimation").attr("rel","unlike"); //applying animation class
				}else{
			        $(this).removeClass("heartAnimation").attr("rel","like9");
			        $(this).css("background-position","left");
				}
		});
		$('body').on("click",'.heart10',function(){
			   var D=$(this).attr("rel");
			   if(D === 'like10') {
				    $(this).addClass("heartAnimation").attr("rel","unlike"); //applying animation class
				}else{
			        $(this).removeClass("heartAnimation").attr("rel","like10");
			        $(this).css("background-position","left");
				}
		});


		//合作客户
		$('#custom li').mouseover(function(){
			$(this).find('span').css('display','block');
			$(this).siblings('li').find('span').css('display','none');
		})

		 //返回顶部
    		$("#toTop").click(function(){
    		    $("html,body").animate({scrollTop:0},"slow");
    		    return false;
    		}); 


});

